package com.huluobo.a2107kotlinshopping.home

import androidx.lifecycle.MutableLiveData
import com.huluobo.a2107kotlinshopping.base.BaseViewModel

/**
 *  Created by LC on 2023/11/15.
 */
class HomeViewModel : BaseViewModel() {
    private val repo = HomeRepo()
    val getGoodsListSuccess = MutableLiveData<HomeGoodsBeanResult>()
    val getGoodsListFailed = MutableLiveData<String>()

    val getHomeBannerSuccess = MutableLiveData<HomeBannerBeanResult>()
    val getHomeBannerFailed = MutableLiveData<String>()

    val getHomeNavSuccess = MutableLiveData<HomeNavBeanResult>()
    val getHomeNavFailed = MutableLiveData<String>()

    fun getHomeGoodsList(
        categoryId: Int,
        currentPage: Int,
        pageSize: Int,
    ) {
        repo.getHomeGoodsList(categoryId, currentPage, pageSize, getGoodsListSuccess, getGoodsListFailed)
    }

    fun getHomeBanner() {
        repo.getHomeBanner(getHomeBannerSuccess, getHomeBannerFailed)
    }

    fun getHomeNav() {
        repo.getHomeNav(getHomeNavSuccess, getHomeNavFailed)
    }
}